cmake_minimum_required(VERSION 3.8)

project(socket_test)

# Default to C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 添加头文件目录
# include_directories(
#   include
#   ${PROJECT_SOURCE_DIR}/../my_utils/include
# )

# 添加静态库文件
# link_directories(
#   ${PROJECT_SOURCE_DIR}/../my_utils/build
# )

# add_executable(test 
#   src/test_client.cpp
# )
# target_link_libraries(test my_utils)

# add_executable(client 
#   src/client.cpp
# )
# target_link_libraries(client my_utils)

# add_executable(server_reconnection 
#   src/server_reconnection.cpp
# )
# target_link_libraries(server_reconnection my_utils)

# add_executable(server_multi_client 
#   src/server_multi_client.cpp
# )
# target_link_libraries(server_multi_client my_utils)

find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBMODBUS REQUIRED libmodbus)

# 查找 Google Test
find_package(GTest REQUIRED)

# 包含目录
include_directories(
  include
  ${GTEST_INCLUDE_DIRS}
)

# 添加源文件
add_executable(test_modbus test/modbus/test_modbus.cpp)
target_link_libraries(test_modbus gtest gtest_main pthread modbus)